<div class="box_right">
	<h1>
		油站结算概况
	</h1>
	<style>
    
    </style>
    <div style="overflow:hidden;">
        <form method="get" action="">
    	    <label class="layui-form-label" style="width: 110px; float: left;">结算日期</label>
        
        	<input style="float:left; width:100px;" type="text" name="date1" class="layui-input" id="test1" placeholder="年-月-日" value="<?php if (isset($date1)){echo $date1;}?>"><span style="float:left; height:38px; line-height:35px;">到</span>
            <input style="float:left; width:100px;" type="text" name="date2" class="layui-input" id="test2" placeholder="年-月-日" value="<?php if (isset($date2)){echo $date2;}?>">
            <button class="btn_tj" type="submit">查询</button>
            <button class="btn_tj empty" type="button">清空全选</button>
            <button class="btn_tj select_all" type="button">全选</button>
            <div  style="padding: 0 28px;margin-top: 20px;">
                <?php foreach($oil_station as $key => $row):?>
                    <span style="padding: 10px;"><input type='checkbox' value='<?php echo $row["id"]?>' name='gass[]'/><?php echo $row["gasstation_name"]?></span>
                    <?php if(($key+1)%5 == 0){echo "<br/>";}?>
                <?php endforeach?>
             </div>
        </form>
     </div>
     <script type="text/javascript">
        var data = '<?php echo $id_json;?>';
        data = JSON.parse(data);
        for (var i = 0; i < data.length; i++) {
            $('input[value="'+data[i]+'"]').attr('checked','checked');
        }
     </script>
    <div style="padding: 0 20px;margin-top: 20px;">
        <span style="margin-left: 10px;"><b>总机显总额:<?php echo $sum_order_price?></b></span>
        <span style="margin-left: 10px;"><b>总营销费用:<?php echo $sum_yx_price?></b></span>
        <span style="margin-left: 10px;"><b>总优惠券费用:<?php echo $sum_coupon_price?></b></span>
        <span style="margin-left: 10px;"><b>总折后金额:<?php echo $sum_zhe_price;?></b></span>
        <span style="margin-left: 10px;"><b>总服务费:<?php echo $sum_service_price;?></b></span>
        <span style="margin-left: 10px;"><b>总转账金额:<?php echo $sum_real_price;?></b></span>
    </div>
	<div class="pro_box layui-form" style="overflow:hidden;">
        <?php foreach($gass_list as $row):?>
		<div style="float:left; margin-left:20px;">
        	
        	<table width="200" border="0" class="layui-table ct" lay-skin="line">
              <tr>
                <th colspan="2" align="center" scope="row" style="background:#F18101; color:#FFF;"><?php echo $row['gasstation_name']?></th>
              </tr>
              <tr>
                <th scope="row">结算日期：</th>
                <td><?php echo $date1;?><br /><?php echo $date2;?></td>
              </tr>
              <tr>
                <th scope="row">机显总额：</th>
                <td><?php if(!empty($row)):?><?php echo $row['order_price'];?><?php else:?>待结算<?php endif;?></td>
              </tr>
              <tr>
                <th scope="row">营销费用：</th>
                <td><?php if(!empty($row)):?><?php echo $row['yx_price'];?><?php else:?>待结算<?php endif;?></td>
              </tr>
              <tr>
                <th scope="row">优惠券费用：</th>
                <td><?php if(!empty($row)):?><?php echo $row['coupon_price'];?><?php else:?>待结算<?php endif;?></td>
              </tr>
              <tr>
                <th scope="row">折后金额：</th>
                <td><?php if(!empty($row)):?><?php echo $row['zhe_price'];?><?php else:?>待结算<?php endif;?></td>
              </tr>
              <tr>
                <th scope="row">服务费：</th>
                <td><?php if(!empty($row)):?><?php echo $row['service_price'];?><?php else:?>待结算<?php endif;?></td>
              </tr>
              <tr>
                <th scope="row">转账金额：</th>
                <td><?php if(!empty($row)):?><?php echo $row['real_price'];?><?php else:?>待结算<?php endif;?></td>
              </tr>
            </table>

        </div>
        <?php endforeach?>
        
  </div>
</div>
<script>

//Demo
layui.use(['form','element','laydate'], function(){
	var form = layui.form,
  	element = layui.element,
  	laydate = layui.laydate;

  //时间选择器
  laydate.render({
    elem: '#test1'
  });
  //时间选择器
  laydate.render({
    elem: '#test2'
  });
});
$('.empty').click(function(){
    $("input[name='gass[]']").prop("checked",false);
})
$('.select_all').click(function(){
    console.log(1);
    $("input[name='gass[]']:not(:checked)").each(function() { 
        $(this).prop("checked",true); 
    });
})
</script>